﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace EdgarReporte
{
    public partial class frmConDLL : Form
    {
        public frmConDLL()
        {
            InitializeComponent();
        }

        //creo la propiedad que recibe el nombre de la impresora
        public String Impresora { get; set; }

        private void frmConDLL_Load(object sender, EventArgs e)
        {

            var printSetting = new System.Drawing.Printing.PageSettings();

            printSetting.PaperSize = new System.Drawing.Printing.PaperSize("ReportAlacran", 583, 827);
            printSetting.Margins = new System.Drawing.Printing.Margins(0, 0, 0, 0);
            //asigno el nombre de la impresora que deseo usar y listo
            printSetting.PrinterSettings.PrinterName = Impresora; 

            reportViewer1.SetPageSettings(printSetting);

            this.reportViewer1.RefreshReport();

            //Aca llamo a dll y listo
            var printReport = new PrintReports.ReportPrintDocument(reportViewer1.LocalReport, printSetting);

            printReport.Print();

            this.Close();
        }
    }
}
